home *** CD-ROM | disk | FTP | other *** search
/ The CICA Windows Explosion! / The CICA Windows Explosion! - Disc 1.iso / desktop / att32all.zip / SETTIME.FRM < prev    next >
Text File  |  1994-10-31  |  21KB  |  785 lines

  1. VERSION 2.00
  2. Begin Form SetTimeForm 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   3  'Fixed Double
  5.    Caption         =   "Set Time"
  6.    ClientHeight    =   1305
  7.    ClientLeft      =   2970
  8.    ClientTop       =   3315
  9.    ClientWidth     =   3570
  10.    ClipControls    =   0   'False
  11.    ControlBox      =   0   'False
  12.    Height          =   1740
  13.    Left            =   2895
  14.    LinkTopic       =   "Form1"
  15.    MaxButton       =   0   'False
  16.    MinButton       =   0   'False
  17.    ScaleHeight     =   1305
  18.    ScaleWidth      =   3570
  19.    Top             =   2955
  20.    Width           =   3720
  21.    Begin SSCommand Command3D1 
  22.       Height          =   465
  23.       Left            =   165
  24.       Picture         =   SETTIME.FRX:0000
  25.       TabIndex        =   18
  26.       Top             =   720
  27.       Width           =   540
  28.    End
  29.    Begin CommandButton Command1 
  30.       Cancel          =   -1  'True
  31.       Caption         =   "Cancel"
  32.       Height          =   360
  33.       Index           =   1
  34.       Left            =   2265
  35.       TabIndex        =   20
  36.       Top             =   765
  37.       Width           =   1155
  38.    End
  39.    Begin CommandButton Command1 
  40.       Caption         =   "Set"
  41.       Default         =   -1  'True
  42.       Height          =   360
  43.       Index           =   0
  44.       Left            =   885
  45.       TabIndex        =   19
  46.       Top             =   765
  47.       Width           =   1155
  48.    End
  49.    Begin PictureBox SpinButton 
  50.       AutoSize        =   -1  'True
  51.       BackColor       =   &H00C0C0C0&
  52.       Height          =   360
  53.       Index           =   1
  54.       Left            =   3255
  55.       ScaleHeight     =   330
  56.       ScaleWidth      =   135
  57.       TabIndex        =   17
  58.       TabStop         =   0   'False
  59.       Top             =   240
  60.       Width           =   165
  61.    End
  62.    Begin SSFrame Frame3D1 
  63.       ForeColor       =   &H00000000&
  64.       Height          =   444
  65.       Index           =   1
  66.       Left            =   1830
  67.       TabIndex        =   11
  68.       Top             =   156
  69.       Width           =   1395
  70.       Begin TextBox tYear 
  71.          BackColor       =   &H00C0C0C0&
  72.          BorderStyle     =   0  'None
  73.          Height          =   225
  74.          Left            =   780
  75.          MaxLength       =   4
  76.          TabIndex        =   14
  77.          Tag             =   "y"
  78.          Text            =   "1955"
  79.          Top             =   150
  80.          Width           =   480
  81.       End
  82.       Begin TextBox tDay 
  83.          BackColor       =   &H00C0C0C0&
  84.          BorderStyle     =   0  'None
  85.          Height          =   225
  86.          Left            =   450
  87.          MaxLength       =   2
  88.          TabIndex        =   13
  89.          Tag             =   "d"
  90.          Text            =   "17"
  91.          Top             =   150
  92.          Width           =   240
  93.       End
  94.       Begin TextBox tMonth 
  95.          Alignment       =   1  'Right Justify
  96.          BackColor       =   &H00C0C0C0&
  97.          BorderStyle     =   0  'None
  98.          Height          =   225
  99.          Left            =   120
  100.          MaxLength       =   2
  101.          TabIndex        =   12
  102.          Tag             =   "n"
  103.          Text            =   "09"
  104.          Top             =   150
  105.          Width           =   240
  106.       End
  107.       Begin Label Label1 
  108.          Alignment       =   2  'Center
  109.          BackColor       =   &H00C0C0C0&
  110.          Caption         =   "/"
  111.          Height          =   225
  112.          Index           =   3
  113.          Left            =   690
  114.          TabIndex        =   16
  115.          Top             =   150
  116.          Width           =   105
  117.       End
  118.       Begin Label Label1 
  119.          Alignment       =   2  'Center
  120.          BackColor       =   &H00C0C0C0&
  121.          Caption         =   "/"
  122.          Height          =   225
  123.          Index           =   2
  124.          Left            =   345
  125.          TabIndex        =   15
  126.          Top             =   150
  127.          Width           =   105
  128.       End
  129.    End
  130.    Begin PictureBox SpinButton 
  131.       AutoSize        =   -1  'True
  132.       BackColor       =   &H00C0C0C0&
  133.       Height          =   360
  134.       Index           =   0
  135.       Left            =   1590
  136.       ScaleHeight     =   330
  137.       ScaleWidth      =   135
  138.       TabIndex        =   7
  139.       TabStop         =   0   'False
  140.       Top             =   240
  141.       Width           =   165
  142.    End
  143.    Begin PictureBox N 
  144.       AutoSize        =   -1  'True
  145.       Height          =   360
  146.       Left            =   2970
  147.       Picture         =   SETTIME.FRX:016A
  148.       ScaleHeight     =   330
  149.       ScaleWidth      =   135
  150.       TabIndex        =   6
  151.       TabStop         =   0   'False
  152.       Top             =   1995
  153.       Visible         =   0   'False
  154.       Width           =   165
  155.    End
  156.    Begin PictureBox U 
  157.       AutoSize        =   -1  'True
  158.       Height          =   360
  159.       Left            =   3180
  160.       Picture         =   SETTIME.FRX:0294
  161.       ScaleHeight     =   330
  162.       ScaleWidth      =   135
  163.       TabIndex        =   5
  164.       TabStop         =   0   'False
  165.       Top             =   1980
  166.       Visible         =   0   'False
  167.       Width           =   165
  168.    End
  169.    Begin PictureBox D 
  170.       AutoSize        =   -1  'True
  171.       Height          =   360
  172.       Left            =   3405
  173.       Picture         =   SETTIME.FRX:03BE
  174.       ScaleHeight     =   330
  175.       ScaleWidth      =   135
  176.       TabIndex        =   0
  177.       TabStop         =   0   'False
  178.       Top             =   1980
  179.       Visible         =   0   'False
  180.       Width           =   165
  181.    End
  182.    Begin SSFrame Frame3D1 
  183.       ForeColor       =   &H00000000&
  184.       Height          =   444
  185.       Index           =   0
  186.       Left            =   168
  187.       TabIndex        =   8
  188.       Top             =   156
  189.       Width           =   1392
  190.       Begin TextBox tHour 
  191.          Alignment       =   1  'Right Justify
  192.          BackColor       =   &H00C0C0C0&
  193.          BorderStyle     =   0  'None
  194.          Height          =   225
  195.          Left            =   120
  196.          MaxLength       =   2
  197.          MultiLine       =   -1  'True
  198.          TabIndex        =   1
  199.          Tag             =   "h"
  200.          Text            =   "12"
  201.          Top             =   150
  202.          Width           =   240
  203.       End
  204.       Begin TextBox tMinute 
  205.          BackColor       =   &H00C0C0C0&
  206.          BorderStyle     =   0  'None
  207.          Height          =   225
  208.          Left            =   456
  209.          MaxLength       =   2
  210.          TabIndex        =   2
  211.          Tag             =   "m"
  212.          Text            =   "00"
  213.          Top             =   150
  214.          Width           =   240
  215.       End
  216.       Begin TextBox tAMPM 
  217.          BackColor       =   &H00C0C0C0&
  218.          BorderStyle     =   0  'None
  219.          Height          =   225
  220.          Left            =   1020
  221.          TabIndex        =   4
  222.          Tag             =   "a"
  223.          Text            =   "am"
  224.          Top             =   150
  225.          Width           =   285
  226.       End
  227.       Begin TextBox tSecond 
  228.          BackColor       =   &H00C0C0C0&
  229.          BorderStyle     =   0  'None
  230.          Height          =   225
  231.          Left            =   780
  232.          MaxLength       =   2
  233.          TabIndex        =   3
  234.          Tag             =   "s"
  235.          Text            =   "00"
  236.          Top             =   150
  237.          Width           =   240
  238.       End
  239.       Begin Label Label1 
  240.          Alignment       =   2  'Center
  241.          BackColor       =   &H00C0C0C0&
  242.          Caption         =   ":"
  243.          Height          =   225
  244.          Index           =   0
  245.          Left            =   345
  246.          TabIndex        =   10
  247.          Top             =   150
  248.          Width           =   105
  249.       End
  250.       Begin Label Label1 
  251.          Alignment       =   2  'Center
  252.          BackColor       =   &H00C0C0C0&
  253.          Caption         =   ":"
  254.          Height          =   225
  255.          Index           =   1
  256.          Left            =   675
  257.          TabIndex        =   9
  258.          Top             =   150
  259.          Width           =   105
  260.       End
  261.    End
  262. End
  263. Option Explicit
  264. DefInt A-Z
  265. Dim LastY As Single
  266. Dim Active As String
  267. Dim LastDirection As String
  268. Dim tVal As Integer
  269.  
  270. ' Jeffrey M. Richter's Spin Button Control from Windows 3: A Developer's Guide
  271. ' Adapted for Visual Basic by Costas Kitsos with Mr. Richter's kind permission
  272.  
  273. ' Windows API functions used by the Spin Button Control
  274. Declare Function GetTickCount Lib "User" () As Long
  275. Declare Function GetAsyncKeyState Lib "User" (ByVal vKey As Integer) As Integer
  276.  
  277. Sub Command1_Click (Index As Integer)
  278. If Index = 0 Then
  279.   Time = tHour.Text + ":" + tMinute.Text + ":" + tSecond.Text + UCase$(tAMPM.Text)
  280.   Date = tMonth.Text + "/" + tDay.Text + "/" + tYear.Text
  281.   LastTime = 0
  282.   LastHour = Val(Format$(Time, "hh"))
  283.   LastQuarter = Val(Format$(Time, "nn")) \ 15
  284.   Unload SetTimeForm
  285. End If
  286. If Index = 1 Then
  287.   LastTime = 0
  288.   Unload SetTimeForm
  289. End If
  290.  
  291. End Sub
  292.  
  293. Sub Command3D1_Click ()
  294. AtomicTimeWasSet = False
  295. Atomic.Show 1
  296. Unload Atomic
  297. If AtomicTimeWasSet Then
  298.    Unload SetTimeForm
  299. End If
  300. End Sub
  301.  
  302. Sub FlipFlopTAMPM ()
  303.          If tAMPM.Text = "am" Then
  304.             tAMPM.Text = "pm"
  305.          Else
  306.             tAMPM.Text = "am"
  307.          End If
  308.  
  309. End Sub
  310.  
  311. Sub Form_GotFocus ()
  312.     tHour.SetFocus
  313.     DoEvents
  314.  
  315. End Sub
  316.  
  317. Sub Form_Load ()
  318. SetTimeForm.Left = Settings.Left + (Settings.Width / 2) - (SetTimeForm.Width / 2)
  319. SetTimeForm.Top = Settings.Top + (Settings.Height / 2) - (SetTimeForm.Height / 2)
  320. Dim Instant As Double
  321. Dim InitialHeight As Integer
  322.     InitialHeight = SpinButton(0).Height
  323.     SpinButton(0).Picture = N.Picture       'Set to the Normal Spin Button
  324.     SpinButton(0).Top = SpinButton(0).Top + (InitialHeight - SpinButton(0).Height) / 2
  325.     SpinButton(1).Picture = N.Picture       'Set to the Normal Spin Button
  326.     SpinButton(1).Top = SpinButton(1).Top + (InitialHeight - SpinButton(1).Height) / 2
  327.     Instant = Now
  328.     If Hour(Instant) = 0 Then
  329.        tHour.Text = "12"
  330.        tAMPM.Text = "am"
  331.     End If
  332.     If Hour(Instant) >= 1 And Hour(Instant) <= 11 Then
  333.        tHour.Text = Format$(Hour(Instant))
  334.        tAMPM.Text = "am"
  335.     End If
  336.     If Hour(Instant) = 12 Then
  337.        tHour.Text = Format$(Hour(Instant))
  338.        tAMPM.Text = "pm"
  339.     End If
  340.     If Hour(Instant) >= 13 And Hour(Instant) <= 23 Then
  341.        tHour.Text = Format$(Hour(Instant) - 12)
  342.        tAMPM.Text = "pm"
  343.     End If
  344.     tMinute.Text = Format$(Minute(Instant), "00")
  345.     tSecond.Text = Format$(Second(Instant), "00")
  346.     tMonth.Text = Format$(Month(Instant), "00")
  347.     tDay.Text = Format$(Day(Instant), "00")
  348.     tYear.Text = Format$(Year(Instant), "0000")
  349.     'SetTimeFOrm.Show
  350.     'DoEvents
  351.  
  352. End Sub
  353.  
  354. Sub MoveDown (c As Control)
  355. Dim CurVal As Integer
  356. CurVal% = Val(c.Text)
  357. Select Case c.Tag
  358.    Case "h"
  359.       If CurVal% = 12 Then
  360.          FlipFlopTAMPM
  361.       End If
  362.       If CurVal% = 1 Then
  363.          c.Text = "12"
  364.       Else
  365.          c.Text = Val(c.Text) - 1
  366.       End If
  367.    Case "m"
  368.       If CurVal% = 0 Then
  369.          c.Text = "59"
  370.       Else
  371.          c.Text = Format$(Val(c.Text) - 1, "00")
  372.       End If
  373.    Case "s"
  374.       If CurVal% = 0 Then
  375.          c.Text = "59"
  376.       Else
  377.          c.Text = Format$(Val(c.Text) - 1, "00")
  378.       End If
  379.    Case "a"
  380.       FlipFlopTAMPM
  381.    Case "n"
  382.       If CurVal% = 1 Then
  383.          c.Text = "12"
  384.       Else
  385.          c.Text = Format$(Val(c.Text) - 1, "00")
  386.       End If
  387.    Case "d"
  388.       If CurVal% = 1 Then
  389.          c.Text = "31"
  390.       Else
  391.          c.Text = Format$(Val(c.Text) - 1, "00")
  392.       End If
  393.    Case "y"
  394.       If CurVal% = 1 Then
  395.          c.Text = "2050"
  396.       Else
  397.          c.Text = Format$(Val(c.Text) - 1, "0000")
  398.       End If
  399. End Select
  400.  
  401. 'c.Text = Val(c.Text) - 1
  402. End Sub
  403.  
  404. Sub MoveUp (c As Control)
  405. Dim CurVal As Integer
  406. CurVal% = Val(c.Text)
  407. Select Case c.Tag
  408.    Case "h"
  409.       If CurVal% = 11 Then
  410.          FlipFlopTAMPM
  411.       End If
  412.       If CurVal% = 12 Then
  413.          c.Text = "1"
  414.       Else
  415.          c.Text = Val(c.Text) + 1
  416.       End If
  417.    Case "m"
  418.       If CurVal% = 59 Then
  419.          c.Text = "00"
  420.       Else
  421.          c.Text = Format$(Val(c.Text) + 1, "00")
  422.       End If
  423.    Case "s"
  424.       If CurVal% = 59 Then
  425.          c.Text = "00"
  426.       Else
  427.          c.Text = Format$(Val(c.Text) + 1, "00")
  428.       End If
  429.    Case "a"
  430.       FlipFlopTAMPM
  431.    Case "n"
  432.       If CurVal% = 12 Then
  433.          c.Text = "01"
  434.       Else
  435.          c.Text = Format$(Val(c.Text) + 1, "00")
  436.       End If
  437.    Case "d"
  438.       If CurVal% = 31 Then
  439.          c.Text = "01"
  440.       Else
  441.          c.Text = Format$(Val(c.Text) + 1, "00")
  442.       End If
  443.    Case "y"
  444.       If CurVal% = 2050 Then
  445.          c.Text = "1980"
  446.       Else
  447.          c.Text = Format$(Val(c.Text) + 1, "0000")
  448.       End If
  449.  
  450. End Select
  451.  
  452. End Sub
  453.  
  454. Sub SpinButton_DblClick (Index As Integer)
  455. If (Index = 1) And (Active$ <> "n") And (Active$ <> "d") And (Active$ <> "y") Then
  456.    tMonth.SetFocus
  457. End If
  458. If (Index = 0) And (Active$ <> "h") And (Active$ <> "m") And (Active$ <> "s") And (Active$ <> "a") Then
  459.    tHour.SetFocus
  460. End If
  461. If LastDirection$ = "u" Then
  462.    Select Case Active$
  463.      Case "n"
  464.         Call MoveUp(tMonth)
  465.      Case "d"
  466.         Call MoveUp(tDay)
  467.      Case "y"
  468.         Call MoveUp(tYear)
  469.      Case "h"
  470.         Call MoveUp(tHour)
  471.      Case "m"
  472.         Call MoveUp(tMinute)
  473.      Case "s"
  474.         Call MoveUp(tSecond)
  475.      Case "a"
  476.         Call MoveUp(tAMPM)
  477.    End Select
  478. Else
  479.    Select Case Active$
  480.      Case "n"
  481.         Call MoveDown(tMonth)
  482.      Case "d"
  483.         Call MoveDown(tDay)
  484.      Case "y"
  485.         Call MoveDown(tYear)
  486.      Case "h"
  487.         Call MoveDown(tHour)
  488.      Case "m"
  489.         Call MoveDown(tMinute)
  490.      Case "s"
  491.         Call MoveDown(tSecond)
  492.      Case "a"
  493.         Call MoveDown(tAMPM)
  494.    End Select
  495. End If
  496. SpinButton(Index).SetFocus
  497. End Sub
  498.  
  499. Sub SpinButton_GotFocus (Index As Integer)
  500. If (Index = 1) And (Active$ <> "n") And (Active$ <> "d") And (Active$ <> "y") Then
  501.    tMonth.SetFocus
  502.    Exit Sub
  503. End If
  504. If (Index = 0) And (Active$ <> "h") And (Active$ <> "m") And (Active$ <> "s") And (Active$ <> "a") Then
  505.    tHour.SetFocus
  506.    Exit Sub
  507. End If
  508.    Select Case Active$
  509.      Case "n"
  510.         tMonth.SetFocus
  511.      Case "d"
  512.         tDay.SetFocus
  513.      Case "y"
  514.         tYear.SetFocus
  515.      Case "h"
  516.         tHour.SetFocus
  517.      Case "m"
  518.         tMinute.SetFocus
  519.      Case "s"
  520.         tSecond.SetFocus
  521.      Case "a"
  522.         tAMPM.SetFocus
  523.    End Select
  524. End Sub
  525.  
  526. Sub SpinButton_MouseDown (Index As Integer, Button As Integer, Shift As Integer, x As Single, Y As Single)
  527.  
  528. Const VK_LBUTTON = &H1
  529. Const TIME_DELAY = 180      ' Time delay between Spin Button Events
  530.  
  531. Dim dwEvent As Long
  532. LastY = Y
  533. ' Make sure that the Spin Button Event occurs at least once
  534. dwEvent = GetTickCount() - TIME_DELAY
  535.  
  536. SpinIt:
  537.  
  538.    ' Do this while the user holds down the left mouse button
  539.    Do While (GetAsyncKeyState(VK_LBUTTON) And &H8000) = -32768
  540.  
  541.         ' Break out of the loop if we haven't waited long enough
  542.         If dwEvent + TIME_DELAY > GetTickCount() Then GoTo Break:
  543.  
  544.         ' If the user wants to increment the counter
  545.         If Y > (SpinButton(Index).Height \ 2) Then
  546.             SpinButton(Index).Picture = d.Picture  ' Set Picture to Up
  547.             If Index = 1 Then
  548.             Select Case Active$
  549.                Case "n"
  550.                    Call MoveDown(tMonth)
  551.                Case "d"
  552.                    Call MoveDown(tDay)
  553.                Case "y"
  554.                    Call MoveDown(tYear)
  555.             End Select
  556.             End If
  557.             If Index = 0 Then
  558.             Select Case Active$
  559.                Case "h"
  560.                    Call MoveDown(tHour)
  561.                Case "s"
  562.                    Call MoveDown(tSecond)
  563.                Case "m"
  564.                    Call MoveDown(tMinute)
  565.                Case "a"
  566.                    Call MoveDown(tAMPM)
  567.             End Select
  568.             End If
  569.             LastDirection$ = "d"
  570.         End If
  571.  
  572.         ' If the user wants to decrement the counter
  573.         If Y < (SpinButton(Index).Height \ 2) Then
  574.             SpinButton(Index).Picture = u.Picture   ' Set Picture to Down
  575.             If Index = 1 Then
  576.             Select Case Active$
  577.                Case "n"
  578.                    Call MoveUp(tMonth)
  579.                Case "d"
  580.                    Call MoveUp(tDay)
  581.                Case "y"
  582.                    Call MoveUp(tYear)
  583.             End Select
  584.             End If
  585.             If Index = 0 Then
  586.             Select Case Active$
  587.                Case "h"
  588.                    Call MoveUp(tHour)
  589.                Case "s"
  590.                    Call MoveUp(tSecond)
  591.                Case "m"
  592.                    Call MoveUp(tMinute)
  593.                Case "a"
  594.                    Call MoveUp(tAMPM)
  595.             End Select
  596.             End If
  597.             LastDirection$ = "u"
  598.         End If
  599.  
  600.         ' Save the last time the Spin Button was active
  601.         dwEvent = GetTickCount()
  602.     Loop
  603.     
  604.     ' Set the Picture to Normal
  605.     SpinButton(Index).Picture = N.Picture
  606.     If Index = 1 Then
  607.     Select Case Active$
  608.        Case "n"
  609.           tMonth.SetFocus
  610.        Case "d"
  611.           tDay.SetFocus
  612.        Case "y"
  613.           tYear.SetFocus
  614.     End Select
  615.     End If
  616.     If Index = 0 Then
  617.     Select Case Active$
  618.        Case "h"
  619.           tHour.SetFocus
  620.        Case "m"
  621.           tMinute.SetFocus
  622.        Case "s"
  623.           tSecond.SetFocus
  624.        Case "a"
  625.           tAMPM.SetFocus
  626.     End Select
  627.     End If
  628.     DoEvents
  629.     
  630.     Exit Sub
  631.  
  632. Break:
  633.     GoTo SpinIt:
  634.  
  635. End Sub
  636.  
  637. Sub tAMPM_GotFocus ()
  638. tAMPM.SelStart = 0
  639. tAMPM.SelLength = 2
  640. Active$ = "a"
  641.  
  642. End Sub
  643.  
  644. Sub tAMPM_KeyPress (KeyAscii As Integer)
  645. If KeyAscii >= 32 Then
  646.    FlipFlopTAMPM
  647.    KeyAscii = 0
  648.    tAMPM.SelStart = 0
  649.    tAMPM.SelLength = 2
  650. End If
  651. End Sub
  652.  
  653. Sub tAMPM_LostFocus ()
  654. If tAMPM.Text <> "am" And tAMPM.Text <> "pm" Then
  655.    tAMPM.Text = "am"
  656. End If
  657.  
  658. End Sub
  659.  
  660. Sub tDay_GotFocus ()
  661. tDay.SelStart = 0
  662. tDay.SelLength = 2
  663. Active$ = "d"
  664. End Sub
  665.  
  666. Sub tDay_KeyPress (KeyAscii As Integer)
  667. If KeyAscii >= 32 Then
  668.    If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = 0
  669. End If
  670.  
  671. End Sub
  672.  
  673. Sub tDay_LostFocus ()
  674. tVal = Val(tDay.Text)
  675. If tVal < 1 Or tVal > 31 Then
  676.    tVal = 1
  677. End If
  678. tDay.Text = Format$(tVal, "00")
  679. End Sub
  680.  
  681. Sub tHour_GotFocus ()
  682. tHour.SelStart = 0
  683. tHour.SelLength = 2
  684. Active$ = "h"
  685. End Sub
  686.  
  687. Sub tHour_KeyPress (KeyAscii As Integer)
  688. If KeyAscii >= 32 Then
  689.    If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = 0
  690. End If
  691.  
  692. End Sub
  693.  
  694. Sub tHour_LostFocus ()
  695. tVal = Val(tHour.Text)
  696. If tVal < 1 Or tVal > 12 Then
  697.    tVal = 12
  698. End If
  699. tHour.Text = Format$(tVal, "0")
  700. End Sub
  701.  
  702. Sub tMinute_GotFocus ()
  703. tMinute.SelStart = 0
  704. tMinute.SelLength = 2
  705. Active$ = "m"
  706. End Sub
  707.  
  708. Sub tMinute_KeyPress (KeyAscii As Integer)
  709. If KeyAscii >= 32 Then
  710.    If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = 0
  711. End If
  712.  
  713. End Sub
  714.  
  715. Sub tMinute_LostFocus ()
  716. tVal = Val(tMinute.Text)
  717. If tVal <= 0 Or tVal > 59 Then
  718.    tVal = 0
  719. End If
  720. tMinute.Text = Format$(tVal, "00")
  721. End Sub
  722.  
  723. Sub tMonth_GotFocus ()
  724. tMonth.SelStart = 0
  725. tMonth.SelLength = 2
  726. Active$ = "n"
  727. End Sub
  728.  
  729. Sub tMonth_KeyPress (KeyAscii As Integer)
  730. If KeyAscii >= 32 Then
  731.    If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = 0
  732. End If
  733. End Sub
  734.  
  735. Sub tMonth_LostFocus ()
  736. tVal = Val(tMonth.Text)
  737. If tVal < 1 Or tVal > 12 Then
  738.    tVal = 12
  739. End If
  740. tMonth.Text = Format$(tVal, "00")
  741. End Sub
  742.  
  743. Sub tSecond_GotFocus ()
  744. tSecond.SelStart = 0
  745. tSecond.SelLength = 2
  746. Active$ = "s"
  747. End Sub
  748.  
  749. Sub tSecond_KeyPress (KeyAscii As Integer)
  750. If KeyAscii >= 32 Then
  751.    If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = 0
  752. End If
  753. End Sub
  754.  
  755. Sub tSecond_LostFocus ()
  756. tVal = Val(tSecond.Text)
  757. If tVal <= 0 Or tVal > 59 Then
  758.    tVal = 0
  759. End If
  760. tSecond.Text = Format$(tVal, "00")
  761. End Sub
  762.  
  763. Sub tYear_GotFocus ()
  764. tYear.SelStart = 0
  765. tYear.SelLength = 4
  766. Active$ = "y"
  767. End Sub
  768.  
  769. Sub tYear_KeyPress (KeyAscii As Integer)
  770. If KeyAscii >= 32 Then
  771.    If KeyAscii < Asc("0") Or KeyAscii > Asc("9") Then KeyAscii = 0
  772. End If
  773.  
  774. End Sub
  775.  
  776. Sub tYear_LostFocus ()
  777. tVal = Val(tYear.Text)
  778. If tVal < 100 Then tVal = tVal + 1900
  779. If tVal < 1980 Or tVal > 2050 Then
  780.    tVal = 1980
  781. End If
  782. tYear.Text = Format$(tVal, "0000")
  783. End Sub
  784.  
  785.